/*
 * @Author: TJN tjn@246@126.com
 * @Date: 2024-06-25 14:52:01
 * @LastEditors: TJN tjn@246@126.com
 * @LastEditTime: 2024-06-27 15:29:41
 * @FilePath: \hdcms-nest\src\soft\soft.controller.ts
 * @Description:
 *
 * Copyright (c) 2024 by ${git_name_email}, All Rights Reserved.
 */
import {
  Controller,
  Get,
  Post,
  Body,
  Patch,
  Param,
  Delete,
  UseGuards,
  Query,
} from '@nestjs/common';
import { SoftService } from './soft.service';
import { CreateSoftDto } from './dto/create-soft.dto';
import { UpdateSoftDto } from './dto/update-soft.dto';
import { AuthGuard } from '@nestjs/passport';

@Controller('soft')
export class SoftController {
  constructor(private readonly softService: SoftService) {}

  @Post()
  @UseGuards(AuthGuard('jwt'))
  create(@Body() createSoftDto: CreateSoftDto) {
    return this.softService.create(createSoftDto);
  }

  @Get()
  findAll(
    @Query('page') page: number = 1,
    @Query('pageSize') pageSize: number = 10,
  ) {
    return this.softService.findAll(+page, +pageSize); // 调用服务方法处理分页查询
  }

  @Get(':id')
  findOne(@Param('id') id: string) {
    return this.softService.findOne(+id);
  }

  @UseGuards(AuthGuard('jwt'))
  @Patch(':id')
  update(@Param('id') id: string, @Body() updateSoftDto: UpdateSoftDto) {
    return this.softService.update(+id, updateSoftDto);
  }

  @Delete(':id')
  @UseGuards(AuthGuard('jwt'))
  remove(@Param('id') id: string) {
    return this.softService.remove(+id);
    
  }
}
